#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stack_link.h"

#define MAXSIZE 1024
/*计算括号是否匹配
 *
 *
 */



	int main()
{
	link_head *list = NULL;		

	Init_Stack(&list);
	char arr[MAXSIZE] = {0};	
	Datatype temp;
	int flag = 0;
//	fgets(arr,MAXSIZE,stdin);	
	gets(arr);
//	printf("%d\n",arr[0]);	
	for(int i = 0;arr[i];i++)
	{
		flag = 0;
		if(arr[i] == '(')
		{
		Push_Stack(list,arr[i]);
		}
		else if(arr[i] == ')')
		{
			if(IsEmpty_Stack(list))
			{
				flag = 1;
				break;
			}
			Pop_Stack(list,&temp);
		}
	}
	if(!IsEmpty_Stack(list))
	{
		flag = 1;
	}
	if(flag)
	{
		printf("NO\n");
	}
	else
	{
		printf("Yse\n");
	}
	Destroy_Stack(list);	



	exit(0);
}
